package com.sunxd.vue.application.controller;

import com.alibaba.fastjson.JSON;
import com.sunxd.vue.bean.Response;
import com.sunxd.vue.bean.request.LoginCheckRequest;
import com.sunxd.vue.domain.bean.domain.User;
import com.sunxd.vue.domain.service.AuthService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.sunxd.vue.infrastructure.utils.ResponseHelper.or500;

/**
 * @author sun.xd
 * @description: description
 * @date 2024/4/2 13:52
 */
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/test/condition")
public class TestCondition {

    private final User user;

    private final AuthService authService;

    @RequestMapping(value = "test1")
    public void test1(){
        System.out.println(JSON.toJSONString(user));
    }


    @RequestMapping(value = "login2")
    public Response<String> login2(@RequestBody LoginCheckRequest req){
        return or500(()->authService.login2(req));
    }
}
